﻿using System;
using System.Data;

using WAF.EntityFramework;

namespace WfhTrader.Core.Entity
{
    /// <summary>
    /// CTP前置机地址
    /// </summary>
    public partial class CtpFrontAddress : WAF.EntityFramework.Entity
    {
        [EntityField(1, label: "用途", isDisplay: true, isNullable: false)]
        public string Purpose { get; set; }

        [EntityField(2, label: "类别", isDisplay: true, isNullable: false)]
        public string Type { get; set; }

        [EntityField(3, label: "地址", isDisplay: true, isNullable: false)]
        public string Address { get; set; }
    }

    /// <summary>
    /// CTP经纪商
    /// </summary>
    public partial class CtpBroker : WAF.EntityFramework.Entity
    {
        [EntityField(1, label: "经纪商代码", isDisplay: true, isNullable: false)]
        public string BrokerCode { get; set; }

        [EntityField(2, label: "经纪商名称", isDisplay: true, isNullable: false)]
        public string BrokerName { get; set; }

        [EntityField(3, label: "备注", isDisplay: true)]
        public string Remark { get; set; }
    }

    /// <summary>
    /// CTP账号
    /// </summary>
    public partial class CtpAccount : WAF.EntityFramework.Entity
    {
        [EntityField(1, label: "用途", isDisplay: true, isNullable: false)]
        public int Purpose { get; set; }

        [EntityField(2, label: "经纪商ID", isDisplay: true, isNullable: false, refTable: "CtpBroker", refLableField: "BrokerName")]
        public long BrokerID { get; set; }

        [EntityField(3, label: "账号", isDisplay: true, isNullable: false)]
        public string AccountNumber { get; set; }

        [EntityField(4, label: "密码", isDisplay: true)]
        public string Password { get; set; }

        [EntityField(5, label: "备注", isDisplay: true)]
        public string Remark { get; set; }
    }



    /// <summary>
    /// 策略交易的账号
    /// </summary>
    public partial class PolicyAccount : WAF.EntityFramework.Entity
    {
        [EntityField(1, label: "策略名称", isDisplay: true, isNullable: false)]
        public string Policy { get; set; }

        [EntityField(2, label: "市场", isDisplay: true, isNullable: false)]
        public string Market { get; set; }

        [EntityField(3, label: "账号", isDisplay: true, isNullable: false)]
        public string Account { get; set; }
    }

    /// <summary>
    /// 策略交易的品种
    /// </summary>
    public partial class PolicyQuote : WAF.EntityFramework.Entity
    {
        [EntityField(1, label: "策略名称", isDisplay: true, isNullable: false)]
        public string Policy { get; set; }

        [EntityField(2, label: "市场", isDisplay: true, isNullable: false)]
        public string Market { get; set; }

        [EntityField(3, label: "代码", isDisplay: true, isNullable: false)]
        public string Code { get; set; }

        [EntityField(4, label: "K线级别", isDisplay: true, isNullable: false)]
        public int Level { get; set; }

        [EntityField(5, label: "K线单位", isDisplay: true, isNullable: false)]
        public string Unit { get; set; }
    }

    /// <summary>
    /// 交易历史记录
    /// </summary>
    public partial class TradeHistory : WAF.EntityFramework.Entity
    {
        [EntityField(1, label: "交易时间", isDisplay: true, isNullable: false)]
        public string TradeTime { get; set; }

        [EntityField(2, label: "交易策略", isDisplay: true, isNullable: false)]
        public string Policy { get; set; }

        [EntityField(3, label: "交易市场", isDisplay: true, isNullable: false)]
        public string Market { get; set; }

        [EntityField(4, label: "交易账号", isDisplay: true, isNullable: false)]
        public string Account { get; set; }

        [EntityField(5, label: "交易品种", isDisplay: true, isNullable: false)]
        public string Code { get; set; }

        [EntityField(6, label: "K线级别", isDisplay: true, isNullable: false)]
        public string Level { get; set; }

        [EntityField(7, label: "K线单位", isDisplay: true, isNullable: false)]
        public string Unit { get; set; }

        [EntityField(8, label: "交易方向", isDisplay: true, isNullable: false)]
        public string Direction { get; set; }

        [EntityField(9, label: "开平标志", isDisplay: true, isNullable: false)]
        public string OpenClose { get; set; }

        [EntityField(10, label: "交易数量", isDisplay: true, isNullable: false)]
        public int Volume { get; set; }

        [EntityField(11, label: "交易价格", isDisplay: true, isNullable: false)]
        public double Price { get; set; }
    }

    /// <summary>
    /// 持仓记录
    /// </summary>
    public partial class Position : WAF.EntityFramework.Entity
    {
        [EntityField(1, label: "交易策略", isDisplay: true, isNullable: false)]
        public string Policy { get; set; }

        [EntityField(2, label: "交易市场", isDisplay: true, isNullable: false)]
        public int Market { get; set; }

        [EntityField(3, label: "交易账号", isDisplay: true, isNullable: false)]
        public string Account { get; set; }

        [EntityField(4, label: "交易品种", isDisplay: true, isNullable: false)]
        public string Code { get; set; }

        [EntityField(5, label: "K线级别", isDisplay: true, isNullable: false)]
        public int Level { get; set; }

        [EntityField(6, label: "K线单位", isDisplay: true, isNullable: false)]
        public int LevelUnit { get; set; }

        [EntityField(7, label: "交易方向", isDisplay: true, isNullable: false)]
        public int Direction { get; set; }

        [EntityField(8, label: "交易价格", isDisplay: true, isNullable: false)]
        public double Price { get; set; }

        [EntityField(9, label: "交易数量", isDisplay: true, isNullable: false)]
        public int Volume { get; set; }
    }

    public partial class PositionDetail
    {
        [EntityField(1, label: "所属持仓Id", isDisplay: true, isNullable: false)]
        public long PositionId { get; set; }

        [EntityField(2, label: "交易时间", isDisplay: true, isNullable: false)]
        public string OpenDateTime { get; set; }

        [EntityField(3, label: "交易价格", isDisplay: true, isNullable: false)]
        public double Price { get; set; }

        [EntityField(4, label: "交易数量", isDisplay: true, isNullable: false)]
        public int Volume { get; set; }
    }

    /// <summary>
    /// 持仓记录
    /// </summary>
    public partial class PositionRecord : WAF.EntityFramework.Entity
    {
        [EntityField(1, label: "交易策略", isDisplay: true, isNullable: false)]
        public string Policy { get; set; }

        [EntityField(2, label: "交易市场", isDisplay: true, isNullable: false)]
        public string Market { get; set; }

        [EntityField(3, label: "交易账号", isDisplay: true, isNullable: false)]
        public string Account { get; set; }

        [EntityField(4, label: "交易品种", isDisplay: true, isNullable: false)]
        public string Code { get; set; }

        [EntityField(5, label: "K线级别", isDisplay: true, isNullable: false)]
        public int Level { get; set; }

        [EntityField(6, label: "K线单位", isDisplay: true, isNullable: false)]
        public string Unit { get; set; }

        [EntityField(7, label: "交易方向", isDisplay: true, isNullable: false)]
        public string Direction { get; set; }

        [EntityField(8, label: "交易数量", isDisplay: true, isNullable: false)]
        public int Volume { get; set; }

        [EntityField(9, label: "交易价格", isDisplay: true, isNullable: false)]
        public double Price { get; set; }
    }

    /// <summary>
    /// 合约信息
    /// </summary>
    public partial class CtpInstrument : WAF.EntityFramework.Entity
    {
        [EntityField(1, isNullable: false, isUnique: true, isDisplay: true, label: "合约代码")]
        public string InstrumentID { get; set; }

        [EntityField(2, label: "交易所代码")]
        public string ExchangeID { get; set; }

        [EntityField(3, label: "合约名称")]
        public string InstrumentName { get; set; }

        [EntityField(4, label: "合约在交易所的代码")]
        public string ExchangeInstID { get; set; }

        [EntityField(5, label: "产品代码")]
        public string ProductID { get; set; }

        [EntityField(6, label: "产品类型")]
        public int ProductClass { get; set; }

        [EntityField(7, label: "交割年份")]
        public int DeliveryYear { get; set; }

        [EntityField(8, label: "交割月")]
        public int DeliveryMonth { get; set; }

        [EntityField(9, label: "市价单最大下单量")]
        public int MaxMarketOrderVolume { get; set; }

        [EntityField(10, label: "市价单最小下单量")]
        public int MinMarketOrderVolume { get; set; }

        [EntityField(11, label: "限价单最大下单量")]
        public int MaxLimitOrderVolume { get; set; }

        [EntityField(12, label: "限价单最小下单量")]
        public int MinLimitOrderVolume { get; set; }

        [EntityField(13, label: "合约数量乘数")]
        public int VolumeMultiple { get; set; }

        [EntityField(14, label: "最小变动价位")]
        public double PriceTick { get; set; }

        [EntityField(15, label: "创建日")]
        public string CreateDate { get; set; }

        [EntityField(16, label: "上市日")]
        public string OpenDate { get; set; }

        [EntityField(17, label: "到期日")]
        public string ExpireDate { get; set; }

        [EntityField(18, label: "开始交割日")]
        public string StartDelivDate { get; set; }

        [EntityField(19, label: "结束交割日")]
        public string EndDelivDate { get; set; }

        [EntityField(20, label: "合约生命周期状态")]
        public int InstLifePhase { get; set; }

        [EntityField(21, label: "当前是否交易")]
        public int IsTrading { get; set; }

        [EntityField(22, label: "持仓类型")]
        public int PositionType { get; set; }

        [EntityField(23, label: "持仓日期类型")]
        public int PositionDateType { get; set; }

        [EntityField(24, label: "多头保证金率")]
        public double LongMarginRatio { get; set; }

        [EntityField(25, label: "空头保证金率")]
        public double ShortMarginRatio { get; set; }
    }
}
